/**
 * Created by HTWX on 2018/3/12.
 */
var express = require('express');
var router = express.Router();
var request=require('request');


router.get('/', function(req, res) {
    var phonevalue=req.query.phonenum;
    var type=req.query.type;
    request.post({url:'http://120.92.89.65/mapi_v2/User/smsSend', form:{phoneNumber:phonevalue,type:type}}, function(error, response, body) {
        if (!error && response.statusCode == 200) {
            var bodystr=JSON.parse(body);
            console.log(bodystr.data);
            res.cookie('smscodes',bodystr.data, {maxAge:100000*6000, path:'/', httpOnly:false});
            res.send(bodystr.data);
        }
    })
});

module.exports = router;